
let obj = {
    name:'zs',
    hobby:['basketball','reading','swimming'],
    address:{
        city:'beijing',
        street:'shanghai'
    },
}
function deepClone(data){
    if(typeof data!=='object' || data ==null){
        return data
    }
    let result;
    if(data instanceof Object){
        result = {}
    }else{
        result = []
    }
    for(let key in data){
        if(data.hasOwnProperty(key)){
            result[key] = deepClone(data[key])
        }
    }
    return result
}
let c1 = deepClone(obj)
console.log(c1.address ===obj.address); //false
console.log(c1.hobby === obj.hobby);  //false

